/**
 * 
 */
package parser.nodes;

import java.util.HashMap;

import parser.AstNode;
import parser.Memory;
import parser.StringMatchSet;

/**
 * @author greg
 * Gets the length of the expression in its left child
 */
public class HashNode extends AstNode {
	/*@Override
	public Object execute(Memory mem) {
		Object lval = this.lchild.execute(mem);
		return executeNode(mem,lval,null);
	}*/
	
	@Override
	protected Object executeNode(HashMap<String,Object> mem, Object lval, Object rval) {
		if((lval instanceof StringMatchSet)) {
			return ((StringMatchSet)lval).size();
		}
		else
		{
			lval = mem.get((String)lval);
			return ((StringMatchSet)lval).size();
		}
	}
	

}
